home *** CD-ROM | disk | FTP | other *** search
/ E.M.Computergraphic Phase 4 / Phase 4 - Desktop Video Dreams (E. M. Computergraphic)(1996).iso / utilities / imagestudio / rexx / regionstore.isrx < prev    next >
Text File  |  1996-01-17  |  3KB  |  102 lines

  1. /* ImageStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /* Make sure there is an image */
  15.  
  16. IMAGEINFO_GET STEM imageinfoinfo.
  17.  
  18. if imageinfoinfo.width == -1 then do
  19.     REQUEST_MESSAGE TEXT '"No image."'
  20.     exit
  21.     end
  22.  
  23. /* Get the region details */
  24.  
  25. REGION_GET STEM regioninfo.
  26.  
  27. if regioninfo.minx == -1 then do
  28.     REQUEST_MESSAGE TEXT '"No region selected."'
  29.     exit
  30.     end
  31.  
  32. clipargs = 'region_minx = 'regioninfo.minx||,
  33.     '; region_miny = 'regioninfo.miny||,
  34.     '; region_width = 'regioninfo.width||,
  35.     '; region_height = 'regioninfo.height
  36.  
  37. if setclip('regioninfo',clipargs) ~= 1 then
  38.     REQUEST_MESSAGE TEXT '"Unable to store region."'
  39. else
  40.     REQUEST_MESSAGE TEXT '"Region stored."'
  41.  
  42. /* END PROGRAM ***************************************************/
  43.  
  44. exit
  45.  
  46. /* On ERROR */
  47.  
  48. ERROR:
  49.  
  50. /* If we get here, either an error occurred with the command's */
  51. /* execution or there was an error with the command itself. */
  52. /* In the former case, rc2 contains the error message and in */
  53. /* the latter, rc2 contains an error number. SIGL contains */
  54. /* the line number of the command which caused the jump */
  55. /* to ERROR: */
  56.  
  57. if datatype(rc2,'NUMERIC') == 1 then do
  58.     /* See if we can describe the error with a string */
  59.  
  60.     select
  61.         when rc2 == 103 then
  62.             err_string = "ERROR 103, "||,
  63.                 "out of memory at line "||SIGL
  64.         when rc2 == 114 then
  65.             err_string = "ERROR 114, "||,
  66.                 "bad command template at line "||SIGL
  67.         when rc2 == 115 then
  68.             err_string = "ERROR 115, "||,
  69.                 "bad number for /N argument at line "||SIGL
  70.         when rc2 == 116 then
  71.             err_string = "ERROR 116, "||,
  72.                 "required argument missing at line "||SIGL
  73.         when rc2 == 117 then
  74.             err_string = "ERROR 117, "||,
  75.                 "value after keywork missing at line "||SIGL
  76.         when rc2 == 118 then
  77.             err_string = "ERROR 118, "||,
  78.                 "wrong number of arguments at line "||SIGL
  79.         when rc2 == 119 then
  80.             err_string = "ERROR 119, "||,
  81.                 "unmatched quotes at line "||SIGL
  82.         when rc2 == 120 then
  83.             err_string = "ERROR 120, "||,
  84.                 "line too long at line "||SIGL
  85.         when rc2 == 236 then
  86.             err_string = "ERROR 236, "||,
  87.                 "unknown command at line "||SIGL
  88.         otherwise
  89.             err_string = "ERROR "||rc2||", at line "||SIGL
  90.         end
  91.         end
  92. else if rc2 == 'RC2' then do
  93.     err_string = "ERROR in command at line "||SIGL
  94.     end
  95. else do
  96.         err_string = rc2||", line "||SIGL
  97.         end
  98.  
  99. request_message TEXT '"'err_string'"'
  100.  
  101. exit
  102.